﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="qlcontest.ascx.cs" Inherits="admin_qlcontest" %>
<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<script>
    function confirmDelete() {
        var agree = confirm("Bạn thật sự muốn xóa dữ liệu này?");
        if (agree)
            return true;
        else
            return false;
    }
</script>
<asp:Label ID="lb" runat="server" Text=""></asp:Label>
<center>
<table width="100%">
    <tr>
        <td>Ngôn ngữ: </td>
        <td>
            <asp:DropDownList ID="lg" runat="server" DataSourceID="SqlDataSource2" 
                DataTextField="lang" DataValueField="id">
            </asp:DropDownList>
            <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                ConnectionString="<%$ ConnectionStrings:canhbuomxanhconnectionstring %>" 
                SelectCommand="SELECT * FROM [Languages]"></asp:SqlDataSource>
        </td>
    </tr>
    <tr>
        <td>Menu: </td>
        <td>
            <asp:TextBox ID="me" runat="server"></asp:TextBox></td>
    </tr>
    <tr>
        <td>Tiêu đề: </td>
        <td>
            <asp:TextBox ID="title" runat="server"></asp:TextBox></td>
    </tr>
    <tr>
        <td>Miêu tả: </td>
        <td>
            <fckeditorv2:fckeditor ID="des" runat="server" BasePath="~/fckeditor/">
            </fckeditorv2:fckeditor>
        </td>
    </tr>
    <tr>
        <td>Nội dung: </td>
        <td>
            <fckeditorv2:fckeditor ID="nd" runat="server" BasePath="~/fckeditor/">
            </fckeditorv2:fckeditor>
        </td>
    </tr>
    <tr>
        <td colspan="2"><center><asp:Button runat="server" ID="addbt" Text="Thêm" 
                onclick="addbt_Click"/></center></td>
    </tr>
</table>
<br />
</center>
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
        AutoGenerateColumns="False" AllowSorting="True"
        CellPadding="4" ForeColor="#333333" GridLines="None"
        PageSize="5" Width="100%" onrowcreated="GridView1_RowCreated" 
        onrowediting="GridView1_RowEditing" 
    onrowcommand="GridView1_RowCommand" DataKeyNames="id,lang" 
    DataSourceID="SqlDataSource1" onrowdeleting="GridView1_RowDeleting">
        <RowStyle BackColor="#EFF3FB" VerticalAlign="Middle" />
        <EmptyDataRowStyle VerticalAlign="Middle" />
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="White" ForeColor="#459300" HorizontalAlign="Center" />
        <EmptyDataTemplate>
             <asp:Label ID="Label3" runat="server" Text="Chưa có dữ liệu"></asp:Label>
        </EmptyDataTemplate>
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <HeaderStyle BackColor="#57A000" Font-Bold="True" ForeColor="White" />
        <Columns>
            <asp:TemplateField HeaderText="ID" SortExpression="id" ItemStyle-HorizontalAlign="Center">
                <EditItemTemplate>
                    <asp:Label ID="id" runat="server" Text='<%# Eval("id") %>'></asp:Label>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="id" runat="server" Text='<%# Bind("id") %>'></asp:Label>
                </ItemTemplate>

<ItemStyle HorizontalAlign="Center"></ItemStyle>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Ngôn ngữ" SortExpression="lang" ItemStyle-HorizontalAlign="Center">
                <EditItemTemplate>
                    <asp:Label ID="lang" runat="server" Text='<%# Eval("lang") %>'></asp:Label>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="lang" runat="server" Text='<%# Bind("lang") %>'></asp:Label>
                </ItemTemplate>

<ItemStyle HorizontalAlign="Center"></ItemStyle>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Menu" SortExpression="menu" ItemStyle-HorizontalAlign="Center">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("menu") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label3" runat="server" Text='<%# Bind("menu") %>'></asp:Label>
                </ItemTemplate>

<ItemStyle HorizontalAlign="Center"></ItemStyle>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Tiêu đề" SortExpression="title" ItemStyle-HorizontalAlign="Center">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("title") %>'></asp:TextBox>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label4" runat="server" Text='<%# Bind("title") %>'></asp:Label>
                </ItemTemplate>

<ItemStyle HorizontalAlign="Center"></ItemStyle>
            </asp:TemplateField>
            <asp:CommandField ShowEditButton="True" ItemStyle-HorizontalAlign="Center" 
                ButtonType="Button" EditText="Chỉnh sửa">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
            </asp:CommandField>
            <asp:TemplateField ShowHeader="False">
                <ItemTemplate>
                    <asp:Button ID="Button1" runat="server" CausesValidation="true" 
                        CommandName="Delete" Text="Xoá" OnClientClick="return confirm('Bạn thật sự muốn xóa dữ liệu này?')" />
                </ItemTemplate>
                <ItemStyle HorizontalAlign="Center" />
            </asp:TemplateField>
        </Columns>
        <EditRowStyle BackColor="#003366" VerticalAlign="Middle" />
        <AlternatingRowStyle BackColor="White" />
    </asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:canhbuomxanhconnectionstring %>" 
    SelectCommand="SELECT * FROM [Contest]"></asp:SqlDataSource>
